home *** CD-ROM | disk | FTP | other *** search
- Path: erich.triumf.ca!bennett
- From: bennett@erich.triumf.ca (P.Bennett)
- Newsgroups: comp.lang.c
- Subject: Re: string and NULL :question
- Date: 17 Feb 1996 09:50 PST
- Organization: TRIUMF: Tri-University Meson Facility
- Distribution: world
- Message-ID: <17FEB199609501198@erich.triumf.ca>
- References: <zakrzews.824018783@pegasus.montclair.edu>
- NNTP-Posting-Host: ftp.triumf.ca
- News-Software: VAX/VMS VNEWS 1.50
-
- In article <zakrzews.824018783@pegasus.montclair.edu>, zakrzews@pegasus.montclair.edu (Tomas Zakrzewski) writes...
- >Hi !
- >
- >Is it save to use a string library and stdio library with strings that are
- >no terminated by NULL charater. If is not, which function may not work correctly
- >and what would happen with non termianded string if a function is applied to
- >that string.
-
- to be (slightly) pedantic, NULL is not a character - it is a macro used to set
- pointers to a known invalid value. (this is probably not a very good
- description, but it's the best I can come up with at the moment...)
-
- You mean the ASCII character nul (one L) which is represented by '\0'.
-
- Almost all C string-handling functions _depend_ on strings being terminated
- with '\0', and will read beyond the intended end of a non-terminated string til
- they find a '\0'.
-
- Exceptions are those fucntions starting with "strn", where you tell the
- function how many chars to look at.
-
-
- Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- Internet: bennett@triumf.ca | of one another only when one can be
- Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
-
-